const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('apartment_energy', {
    id: {
      type: DataTypes.STRING(40),
      allowNull: false,
      primaryKey: true
    },
    apartment: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "小区名字"
    },
    floor: {
      type: DataTypes.STRING(255),
      allowNull: false,
      comment: "楼栋"
    },
    electricity: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "电耗"
    },
    water: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "水耗"
    },
    gas: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "气耗"
    },
    year: {
      type: DataTypes.STRING(4),
      allowNull: true
    },
    month: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    estimateElectricity: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "预计电耗"
    },
    estimateWater: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "预计水耗"
    },
    estimateGas: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "预计气耗"
    }
  }, {
    sequelize,
    tableName: 'apartment_energy',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
